package com.fit.entities.member;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;


import com.fit.entities.user.User;
import com.fit.model.UserRole;


@Entity
@Table(name="member")

public class Member {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@NonVisual
	@Column(name="member_id")
	private Long memberId;
	
	
	 @Column(name="name", nullable=false)
	 private String name;
	
	 @Column(nullable = false, name = "role")
		private UserRole role;
	 
	 @Column(name="surname", nullable=false)
	 private String surname;
	 
	 @OneToOne(cascade = CascadeType.ALL,optional=false)
		@JoinColumn(name="user_id")
		private User user;
		
	public Long getMemberId() {
		return memberId;
	}
	public void setMemberId(Long memberId) {
		this.memberId = memberId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		this.surname = surname;
	}

	

	public UserRole getRole() {
		return role;
	}
	public void setRole(UserRole role) {
		this.role = role;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	
}
